import _request from "../common/_request";
import {Message} from "element-ui";
import _router from "../common/_router";

let api_saler = {

    //员工信息
    info: function (sid, callback) {

        let data = {};
        data.sid = sid;
        _request._get('/saler/info', data, function (response) {
            if (response.code !== _request.success) {
                Message.info(response.msg);
                return;
            }

            callback(response.data)
        })
    },


    //登录
    login: function (activity_id, callback) {

        let data = {};
        data.activity_id = activity_id;
        _request._get('/saler/login', data, function (response) {
            if (response.code !== _request.success) {
                _router.jmp_error(response.msg)
                return;
            }

            callback(response.data)
        })
    },

    // 注册
    register: function ( data, callback) {

        _request._post('/saler/register', data, function (response) {
            if (response.code !== _request.success) {
                _router.jmp_error(response.msg)
                return;
            }

            callback(response.data)
        })
    },

}


export default api_saler
